<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="__ROOT__/Public/Admin/css/shortcut icon" href="favicon.ico">
    <link href="__ROOT__/Public/Admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/animate.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/js/plugins/cityPicker/city-picker.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/js/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/edit.css" rel="stylesheet"/>

</head>
<body class="gray-bg">

<body class="gray-bg body_box">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">

        <form class="js-ajax-forms" id="signupForm" action="{:U('Admin/Form/edit')}" method="post" enctype="multipart/form-data">
            <div class="col-sm-8 col-sm-offset-2">
			<input type="hidden" name="ID" value="{$data.ID}">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                    		<if condition="empty($select_categorys) neq true">
	                            <div class="form-group row">
	                                <label class="col-md-3 col-sm-2 control-label text-right ">父表单显示名</label>
	                                <div class="col-sm-8">
	                                    <select class="form-control m-b" name="ParentID"  style="margin-bottom: 0px;">
	                                    	<option value="0"></option>
                                    		{$select_categorys}
                                		</select>
	                                </div>
	                            </div>
                            </if>
                        <div class="form-group row" >
                            <label class="col-md-3 col-sm-2 control-label text-right ">表单显示名 *</label>
                            <div class="col-md-4 col-sm-6 ">
                                <input id="CName" name="CName" class="form-control" value="{$data.CName}" type="text" aria-required="true" aria-invalid="true">
                            </div>
                        </div>

                        <div class="form-group row" >
                            <label class="col-md-3 col-sm-2 control-label text-right ">表单路由</label>
                            <div class="col-md-4 col-sm-6 ">
                                <input id="Name" name="Name" class="form-control" value="{$data.Name}" aria-required="true" aria-invalid="true">
                            </div>
                        </div>

                        

                        <div class="form-group row">
                            <div class="col-sm-8 col-sm-offset-3">
                                <button class="btn btn-primary" type="submit">保存</button>
                                <a class="btn btn-white" href="javascript:void(0);" onclick="self.location=document.referrer;">返回</a>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<script src="__ROOT__/Public/Admin/js/jquery.min.js?v=2.1.4"></script>
<script src="__ROOT__/Public/Admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__ROOT__/Public/Admin/js/plugins/layer/layer.min.js"></script>
<script src="__ROOT__/Public/Admin/js/plugins/sweetalert/sweetalert.min.js"></script>
<script type="text/javascript" src="__ROOT__/Public/Admin/js/ajaxForm.js"></script>
<script src="__ROOT__/Public/Admin/js/plugins/validate/jquery.validate.min.js"></script>
<script src="__ROOT__/Public/Admin/js/plugins/validate/messages_zh.min.js"></script>
<script src="__ROOT__/Public/Admin/js/plugins/cityPicker/city-picker.data.js"></script>
<script src="__ROOT__/Public/Admin/js/plugins/cityPicker/city-picker.js"></script>
<script src="__ROOT__/Public/Admin/js/plugins/cityPicker/main.js"></script>
<script src="__ROOT__/Public/Admin/js/plugins/layer/laydate/laydate.js"></script>
<script type="text/javascript">
    $(document).ready(function () {

        var icon = "<i class='fa fa-times-circle'></i> ";
        var form = $('form.js-ajax-forms');
        var formloading = false;
        //表单验证开始
        form.validate({
            //验证规则
            rules: {
                CName: {
                    required: true,
                    Name : false,
                    rangelength: [1, 30]//输入值必须介于 15 和 18 之间。
                }
            },
            //验证未通过提示消息
            messages: {
                CName: {
                    required: icon + "请输入表单显示名称",
                    maxlength: icon + "请输入表单显示名"
                }
            },
            //验证通过，提交表单
            submitHandler: function (forms) {
                if (formloading)
                    return;
                $(forms).ajaxSubmit({
                    url: form.attr('action'), //按钮上是否自定义提交地址(多按钮情况)
                    dataType: 'json',
                    beforeSubmit: function (arr, $form, options) {
                        formloading = true;
                    },
                    success: function (data, statusText, xhr, $form) {
                        formloading = false;
                        if (data.status) {
                            //添加成功
                            swal({
                                        title: "提示",
                                        text: "操作成功！",
                                        type: "success",
                                        showCancelButton: true,
                                        confirmButtonColor: "#DD6B55",
                                        confirmButtonText: "确认",
                                        cancelButtonText: "返回",
                                        closeOnConfirm: false,
                                        closeOnCancel: false
                                    },
                                    function (isConfirm) {
                                        if (isConfirm) {
                                            //swal("删除成功！", "您已经永久删除了这条信息。", "success");
                                            document.location.reload();
                                        } else {
                                            document.location.href = "{:U('Admin/Form/index')}";
                                            //swal("已取消", "您取消了删除操作！", "error");
                                            return true;
                                        }
                                    });

                        } else {
                            swal("操作失败", data.info, "error");
                        }
                    }
                });
            }
        });
    });
</script>
</body>
</html>